import time
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
#
# driver.get('https://y.qq.com/portal/pop_login.html')
# driver.maximize_window()
# driver.implicitly_wait(15)
#
# 点击密码登录
iframe = driver.find_element(By.TAG_NAME,'iframe')
driver.switch_to.frame(iframe)

driver.find_element(By.ID,'switcher_plogin').click()
time.sleep(3)
# 输入账户密码
driver.find_elements(By.CLASS_NAME,'inputstyle')[0].send_keys('2197329067')
driver.find_elements(By.CLASS_NAME,'inputstyle')[1].send_keys("dy010903.")
time.sleep(2)
# 登录
driver.find_element(By.CLASS_NAME,'login_button').click()
time.sleep(6)

driver.get("https://y.qq.com/")
# 隐式等待
driver.implicitly_wait(15)
# 全屏
driver.maximize_window()
# 点击登录
driver.find_element(By.CLASS_NAME,'top_login__link').click()
iframe = driver.find_elements(By.TAG_NAME,'iframe')[0]
driver.switch_to.frame(iframe)
iframe2 = driver.find_element(By.ID,'ptlogin_iframe')
driver.switch_to.frame(iframe2)
# 点击头像，进行快捷登录
driver.find_element(By.XPATH,'//*[@id="qlogin_list"]/a').click()
driver.switch_to.default_content()
time.sleep(5)